<!DOCTYPE html>



  


<html class="theme-next pisces use-motion" lang="zh-Hans">
<head>
  <meta charset="UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>
<meta name="theme-color" content="#222">









<meta http-equiv="Cache-Control" content="no-transform" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
















  
  
  <link href="/lib/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css" />







<link href="/lib/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css" />

<link href="/css/main.css?v=5.1.4" rel="stylesheet" type="text/css" />


  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png?v=5.1.4">


  <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32-next.png?v=5.1.4">


  <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16-next.png?v=5.1.4">


  <link rel="mask-icon" href="/images/logo.svg?v=5.1.4" color="#222">





  <meta name="keywords" content="Hexo, NexT" />










<meta name="description" content="IDEA Templet1234567891011/**  * Created By  醉美柳舞之众星捧月  * @author $&amp;#123;USER&amp;#125;   * @date $&amp;#123;DATE&amp;#125; $&amp;#123;TIME&amp;#125;  */  /**    * Author song  醉美柳舞之众星捧月    * Date &amp;amp; Time  $DATA$ $TIME">
<meta property="og:type" content="article">
<meta property="og:title" content="Init">
<meta property="og:url" content="http://smallkk.gitee.io/2018/04/19/init/index.html">
<meta property="og:site_name" content="Hi , 小坤坤">
<meta property="og:description" content="IDEA Templet1234567891011/**  * Created By  醉美柳舞之众星捧月  * @author $&amp;#123;USER&amp;#125;   * @date $&amp;#123;DATE&amp;#125; $&amp;#123;TIME&amp;#125;  */  /**    * Author song  醉美柳舞之众星捧月    * Date &amp;amp; Time  $DATA$ $TIME">
<meta property="og:locale" content="zh-Hans">
<meta property="og:image" content="https://sxk.s3.didiyunapi.com/pic/elk/1.jpg">
<meta property="og:updated_time" content="2018-04-30T19:04:18.853Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="Init">
<meta name="twitter:description" content="IDEA Templet1234567891011/**  * Created By  醉美柳舞之众星捧月  * @author $&amp;#123;USER&amp;#125;   * @date $&amp;#123;DATE&amp;#125; $&amp;#123;TIME&amp;#125;  */  /**    * Author song  醉美柳舞之众星捧月    * Date &amp;amp; Time  $DATA$ $TIME">
<meta name="twitter:image" content="https://sxk.s3.didiyunapi.com/pic/elk/1.jpg">



<script type="text/javascript" id="hexo.configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/',
    scheme: 'Pisces',
    version: '5.1.4',
    sidebar: {"position":"left","display":"post","offset":12,"b2t":false,"scrollpercent":false,"onmobile":false},
    fancybox: true,
    tabs: true,
    motion: {"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},
    duoshuo: {
      userId: '0',
      author: '博主'
    },
    algolia: {
      applicationID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    }
  };
</script>



  <link rel="canonical" href="http://smallkk.gitee.io/2018/04/19/init/"/>





  <title>Init | Hi , 小坤坤</title>
  








</head>

<body itemscope itemtype="http://schema.org/WebPage" lang="zh-Hans">

  
  
    
  

  <div class="container sidebar-position-left page-post-detail">
    <div class="headband"></div>

    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-wrapper">
  <div class="site-meta ">
    

    <div class="custom-logo-site-title">
      <a href="/"  class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">Hi , 小坤坤</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
      
        <p class="site-subtitle"></p>
      
  </div>

  <div class="site-nav-toggle">
    <button>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
    </button>
  </div>
</div>

<nav class="site-nav">
  

  
    <ul id="menu" class="menu">
      
        
        <li class="menu-item menu-item-home">
          <a href="/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-home"></i> <br />
            
            首页
          </a>
        </li>
      
        
        <li class="menu-item menu-item-archives">
          <a href="/archives/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-archive"></i> <br />
            
            归档
          </a>
        </li>
      

      
    </ul>
  

  
</nav>



 </div>
    </header>

    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  

  
  
  

  <article class="post post-type-normal" itemscope itemtype="http://schema.org/Article">
  
  
  
  <div class="post-block">
    <link itemprop="mainEntityOfPage" href="http://smallkk.gitee.io/2018/04/19/init/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="name" content="S-Name Small·kk">
      <meta itemprop="description" content="">
      <meta itemprop="image" content="/images/avatar.gif">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="Hi , 小坤坤">
    </span>

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">Init</h1>
        

        <div class="post-meta">
          <span class="post-time">
            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">发表于</span>
              
              <time title="创建于" itemprop="dateCreated datePublished" datetime="2018-04-19T03:17:59+08:00">
                2018-04-19
              </time>
            

            

            
          </span>

          

          
            
          

          
          

          

          

          

        </div>
      </header>
    

    
    
    
    <div class="post-body" itemprop="articleBody">

      
      

      
        <h6 id="IDEA-Templet"><a href="#IDEA-Templet" class="headerlink" title="IDEA Templet"></a>IDEA Templet</h6><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br></pre></td><td class="code"><pre><span class="line">/**</span><br><span class="line">  * Created By  醉美柳舞之众星捧月</span><br><span class="line">  * @author $&#123;USER&#125; </span><br><span class="line">  * @date $&#123;DATE&#125; $&#123;TIME&#125;</span><br><span class="line">  */</span><br><span class="line">  </span><br><span class="line">/**</span><br><span class="line">    * Author song  醉美柳舞之众星捧月</span><br><span class="line">    * Date &amp; Time  $DATA$ $TIME$</span><br><span class="line">    * Description  $END$</span><br><span class="line">    */</span><br></pre></td></tr></table></figure>
<h6 id="CentOS："><a href="#CentOS：" class="headerlink" title="CentOS："></a>CentOS：</h6><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">systemctl set-default graphical.target 由命令行模式更改为图形界面模式</span><br><span class="line"></span><br><span class="line">systemctl set-default multi-user.target 由图形界面模式更改为命令行模式</span><br></pre></td></tr></table></figure>
<h6 id="释放内存："><a href="#释放内存：" class="headerlink" title="释放内存："></a>释放内存：</h6><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br></pre></td><td class="code"><pre><span class="line">1. 释放网页缓存(To free pagecache):</span><br><span class="line"></span><br><span class="line">sync; echo 1 &gt; /proc/sys/vm/drop_caches</span><br><span class="line"></span><br><span class="line">2. 释放目录项和索引(To free dentries and inodes):</span><br><span class="line"></span><br><span class="line">sync; echo 2 &gt; /proc/sys/vm/drop_caches</span><br><span class="line"></span><br><span class="line">3. 释放网页缓存，目录项和索引（To free pagecache, dentries and inodes）:</span><br><span class="line"></span><br><span class="line">sync; echo 3 &gt; /proc/sys/vm/drop_caches</span><br></pre></td></tr></table></figure>
<h6 id="port"><a href="#port" class="headerlink" title="port:"></a>port:</h6><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br></pre></td><td class="code"><pre><span class="line">netstat -nupl (UDP类型的端口)</span><br><span class="line">netstat -ntpl (TCP类型的端口)</span><br><span class="line">netstat -anp 显示系统端口使用情况</span><br><span class="line"></span><br><span class="line">-   a 表示所有</span><br><span class="line">-   n 表示不查询dns (显示ip,可以加速操作)</span><br><span class="line">-   t 表示tcp协议</span><br><span class="line">-   u 表示udp协议</span><br><span class="line">-   p 表示查询占用的程序</span><br><span class="line">-   l 表示查询正在监听的程序</span><br><span class="line"></span><br><span class="line">---</span><br><span class="line"></span><br><span class="line">netstat -ntlp   //查看当前所有tcp端口·</span><br><span class="line">netstat -ntulp |grep 80   //查看所有80端口使用情况·</span><br><span class="line">netstat -an | grep 3306   //查看所有3306端口使用情况·</span><br><span class="line">netstat  -lanp  //查看一台服务器上面哪些服务及端口</span><br><span class="line">ps -ef |grep mysqld //查看一个服务有几个端口。比如要查看mysqld</span><br><span class="line">netstat -pnt |grep :3306 |wc    //查看某一端口的连接数量,比如3306端口</span><br><span class="line">netstat -anp |grep 3306 //查看某一端口的连接客户端IP 比如3306端口</span><br><span class="line">netstat -an //查看网络端口 </span><br><span class="line"></span><br><span class="line">lsof -i :port，使用lsof -i :port就能看见所指定端口运行的程序，同时还有当前连接。</span><br></pre></td></tr></table></figure>
<h6 id="rpm"><a href="#rpm" class="headerlink" title="rpm:"></a>rpm:</h6><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br></pre></td><td class="code"><pre><span class="line">rpm 常用命令</span><br><span class="line">1.安装一个包 </span><br><span class="line"># rpm -ivh </span><br><span class="line"></span><br><span class="line">2.升级一个包 </span><br><span class="line"># rpm -Uvh </span><br><span class="line"></span><br><span class="line">3.卸载一个包 </span><br><span class="line"># rpm -e </span><br><span class="line">如果遇到依赖，无法删除，使用 rpm -e --nodeps &lt;包的名字&gt; 不检查依赖，直接删除rpm包。 </span><br><span class="line"></span><br><span class="line"></span><br><span class="line">4.查询一个包是否被安装 </span><br><span class="line"># rpm -q &lt; rpm package name&gt; </span><br><span class="line"></span><br><span class="line">5.得到被安装的包的信息 </span><br><span class="line"># rpm -qi &lt; rpm package name&gt; </span><br><span class="line"></span><br><span class="line">tar -cvjpf etc.tar.bz2 /etc　　//-c为创建一个打包文件，相应的-f后面接创建的文件的名称，使用了.tar.bz2后缀，-j标志使用bzip2压缩，最后面为具体的操作对象/etc目录</span><br></pre></td></tr></table></figure>
<h6 id="redis"><a href="#redis" class="headerlink" title="redis"></a>redis</h6><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br></pre></td><td class="code"><pre><span class="line">1. 安装redis编译的c环境，yum install gcc-c++</span><br><span class="line"></span><br><span class="line">2. 将redis-2.6.16.tar.gz上传到Linux系统中</span><br><span class="line"></span><br><span class="line">3. 解压到/usr/local下  tar -xvf redis-2.6.16.tar.gz -C /usr/local</span><br><span class="line"></span><br><span class="line">4. 进入redis-2.6.16目录 使用make命令编译redis</span><br><span class="line"></span><br><span class="line">5. 在redis-2.6.16目录中 使用make PREFIX=/usr/local/redis install命令安装			redis到/usr/local/redis中</span><br><span class="line"></span><br><span class="line">6. 拷贝redis-2.6.16中的redis.conf到安装目录redis中</span><br><span class="line"></span><br><span class="line">7. 启动redis 在bin下执行命令redis-server redis.conf</span><br><span class="line"></span><br><span class="line">8. 如需远程连接redis，需配置redis端口6379在linux防火墙中开发</span><br><span class="line">/sbin/iptables -I INPUT -p tcp --dport 6379 -j ACCEPT</span><br><span class="line">/etc/rc.d/init.d/iptables save</span><br><span class="line"></span><br><span class="line">9. 将redis.conf文件中的daemonize从false修改成true表示后台启动</span><br><span class="line"></span><br><span class="line">10. 若要远程连接的话,1.&lt;code&gt;bind 127.0.0.1改为 #bind 127.0.0.1&lt;/code&gt;,2.&lt;code&gt;protected-mode yes 改为 protected-mode no&lt;/code&gt;</span><br></pre></td></tr></table></figure>
<h6 id="MySQL"><a href="#MySQL" class="headerlink" title="MySQL"></a>MySQL</h6><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br></pre></td><td class="code"><pre><span class="line"></span><br><span class="line">CentOS7默认数据库是mariadb,配置等用着不习惯,因此决定改成mysql,但是CentOS7的yum源中默认好像是没有mysql的。为了解决这个问题，我们要先下载mysql的repo源。</span><br><span class="line"></span><br><span class="line">1.下载mysql的repo源</span><br><span class="line"></span><br><span class="line">$ wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm</span><br><span class="line"></span><br><span class="line">2.安装mysql-community-release-el7-5.noarch.rpm包</span><br><span class="line"></span><br><span class="line">$ sudo rpm -ivh mysql-community-release-el7-5.noarch.rpm</span><br><span class="line"></span><br><span class="line">安装这个包后，会获得两个mysql的yum repo源：/etc/yum.repos.d/mysql-community.repo，/etc/yum.repos.d/mysql-community-source.repo。</span><br><span class="line"></span><br><span class="line">3.安装mysql</span><br><span class="line"></span><br><span class="line">$ sudo yum install mysql-server</span><br><span class="line"></span><br><span class="line">根据提示安装就可以了,不过安装完成后没有密码,需要重置密码</span><br><span class="line"></span><br><span class="line">4.重置mysql密码</span><br><span class="line"></span><br><span class="line">$ mysql -u root</span><br><span class="line"></span><br><span class="line">登录时有可能报这样的错：ERROR 2002 (HY000): Can‘t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock‘ </span><br><span class="line">(2)，原因是/var/lib/mysql的访问权限问题。下面的命令把/var/lib/mysql的拥有者改为当前用户：</span><br><span class="line"></span><br><span class="line">$ sudo chown -R root:root /var/lib/mysql</span><br><span class="line"></span><br><span class="line">重启mysql服务</span><br><span class="line"></span><br><span class="line">$ service mysqld restart</span><br><span class="line"></span><br><span class="line">接下来登录重置密码：</span><br><span class="line"></span><br><span class="line">$ mysql -u root  //直接回车进入mysql控制台</span><br><span class="line"></span><br><span class="line">mysql &gt; use mysql;</span><br><span class="line"></span><br><span class="line">mysql &gt; update user set password=password(&apos;war3sxkcs&apos;) where user=&apos;root&apos;;</span><br><span class="line"></span><br><span class="line">mysql &gt; grant all privileges on *.* to &apos;root&apos;@&apos;%&apos; identified by &apos;war3sxkcs&apos; with grant option; //开启远程可连接</span><br><span class="line"></span><br><span class="line">mysql &gt; flush privileges;</span><br><span class="line"></span><br><span class="line">mysql &gt; exit;</span><br><span class="line"></span><br><span class="line">---</span><br><span class="line"></span><br><span class="line">查看mysql的安装</span><br><span class="line">rpm -qa|grep -i mysql</span><br><span class="line"></span><br><span class="line">停止/卸载mysql</span><br><span class="line">rpm -e --noscripts MySQL-client-5.5.25a-1.rhel5</span><br><span class="line"></span><br><span class="line">rpm -ev mysql-community-libs-5.7.21-1.el7.x86_64 --nodeps</span><br><span class="line"></span><br><span class="line">find / -name mysql</span><br></pre></td></tr></table></figure>
<h6 id="wifi"><a href="#wifi" class="headerlink" title="wifi"></a>wifi</h6><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">nmcli dev wifi list</span><br></pre></td></tr></table></figure>
<h6 id="firewall"><a href="#firewall" class="headerlink" title="firewall"></a>firewall</h6><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br></pre></td><td class="code"><pre><span class="line">Centos 7 firewall 命令：</span><br><span class="line"></span><br><span class="line">查看已经开放的端口：</span><br><span class="line"></span><br><span class="line">firewall-cmd --list-ports</span><br><span class="line">开启端口</span><br><span class="line"></span><br><span class="line">firewall-cmd --zone=public --add-port=80/tcp --permanent</span><br><span class="line">命令含义：</span><br><span class="line"></span><br><span class="line">–zone #作用域</span><br><span class="line"></span><br><span class="line">–add-port=80/tcp #添加端口，格式为：端口/通讯协议</span><br><span class="line"></span><br><span class="line">–permanent #永久生效，没有此参数重启后失效</span><br><span class="line"></span><br><span class="line">重启防火墙</span><br><span class="line"></span><br><span class="line">firewall-cmd --reload #重启firewall</span><br><span class="line">systemctl stop firewalld.service #停止firewall</span><br><span class="line">systemctl disable firewalld.service #禁止firewall开机启动</span><br><span class="line">firewall-cmd --state #查看默认防火墙状态（关闭后显示notrunning，开启后显示running）</span><br><span class="line">CentOS 7 以下版本 iptables 命令</span><br><span class="line"></span><br><span class="line">如要开放80，22，8080 端口，输入以下命令即可</span><br><span class="line"></span><br><span class="line">/sbin/iptables -I INPUT -p tcp --dport 80 -j ACCEPT</span><br><span class="line">/sbin/iptables -I INPUT -p tcp --dport 22 -j ACCEPT</span><br><span class="line">/sbin/iptables -I INPUT -p tcp --dport 8080 -j ACCEPT</span><br><span class="line">然后保存：</span><br><span class="line"></span><br><span class="line">/etc/rc.d/init.d/iptables save</span><br><span class="line">查看打开的端口：</span><br><span class="line"></span><br><span class="line">/etc/init.d/iptables status</span><br><span class="line">关闭防火墙 </span><br><span class="line">1） 永久性生效，重启后不会复原</span><br><span class="line"></span><br><span class="line">开启： chkconfig iptables on</span><br><span class="line"></span><br><span class="line">关闭： chkconfig iptables off</span><br><span class="line"></span><br><span class="line">2） 即时生效，重启后复原</span><br><span class="line"></span><br><span class="line">开启： service iptables start</span><br><span class="line"></span><br><span class="line">关闭： service iptables stop</span><br><span class="line"></span><br><span class="line">查看防火墙状态： service iptables status</span><br><span class="line"></span><br><span class="line">下面说下CentOS7和6的默认防火墙的区别</span><br><span class="line"></span><br><span class="line">CentOS 7默认使用的是firewall作为防火墙，使用iptables必须重新设置一下</span><br><span class="line"></span><br><span class="line">1、直接关闭防火墙</span><br><span class="line"></span><br><span class="line">systemctl stop firewalld.service #停止firewall</span><br><span class="line"></span><br><span class="line">systemctl disable firewalld.service #禁止firewall开机启动</span><br><span class="line"></span><br><span class="line">2、设置 iptables service</span><br><span class="line"></span><br><span class="line">yum -y install iptables-services</span><br><span class="line"></span><br><span class="line">如果要修改防火墙配置，如增加防火墙端口3306</span><br><span class="line"></span><br><span class="line">vi /etc/sysconfig/iptables </span><br><span class="line"></span><br><span class="line">增加规则</span><br><span class="line"></span><br><span class="line">-A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT</span><br><span class="line"></span><br><span class="line">保存退出后</span><br><span class="line"></span><br><span class="line">systemctl restart iptables.service #重启防火墙使配置生效</span><br><span class="line"></span><br><span class="line">systemctl enable iptables.service #设置防火墙开机启动</span><br><span class="line"></span><br><span class="line">最后重启系统使设置生效即可。</span><br><span class="line"></span><br><span class="line">systemctl start iptables.service #打开防火墙</span><br><span class="line"></span><br><span class="line">systemctl stop iptables.service #关闭防火墙</span><br></pre></td></tr></table></figure>
<h6 id="Zookeeper"><a href="#Zookeeper" class="headerlink" title="Zookeeper"></a>Zookeeper</h6><hr>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br><span class="line">84</span><br><span class="line">85</span><br><span class="line">86</span><br><span class="line">87</span><br><span class="line">88</span><br><span class="line">89</span><br><span class="line">90</span><br><span class="line">91</span><br><span class="line">92</span><br><span class="line">93</span><br><span class="line">94</span><br><span class="line">95</span><br><span class="line">96</span><br><span class="line">97</span><br><span class="line">98</span><br><span class="line">99</span><br><span class="line">100</span><br><span class="line">101</span><br><span class="line">102</span><br><span class="line">103</span><br><span class="line">104</span><br><span class="line">105</span><br><span class="line">106</span><br><span class="line">107</span><br><span class="line">108</span><br></pre></td><td class="code"><pre><span class="line">1、创建 /usr/local/services/zookeeper 文件夹：</span><br><span class="line">    mkdir -p /usr/local/services/zookeeper</span><br><span class="line"> </span><br><span class="line">2、进入到 /usr/local/services/zookeeper 目录中：</span><br><span class="line">    cd /usr/local/services/zookeeper</span><br><span class="line"> </span><br><span class="line">3、下载 zookeeper-3.4.9.tar.gz：</span><br><span class="line">    wget https://mirrors.tuna.tsinghua.edu.cn/apache/zookeeper/zookeeper-3.4.9/zookeeper-3.4.9.tar.gz</span><br><span class="line"> </span><br><span class="line">4、解压缩 zookeeper-3.4.9.tar.gz：</span><br><span class="line">    tar -zxvf zookeeper-3.4.9.tar.gz</span><br><span class="line"> </span><br><span class="line">5、进入到 /usr/local/services/zookeeper/zookeeper-3.4.9/conf 目录中：</span><br><span class="line">    cd zookeeper-3.4.9/conf/</span><br><span class="line"> </span><br><span class="line">6、复制 zoo_sample.cfg 文件的并命名为为 zoo.cfg：</span><br><span class="line">    cp zoo_sample.cfg zoo.cfg</span><br><span class="line"> </span><br><span class="line">7、用 vim 打开 zoo.cfg 文件并修改其内容为如下：</span><br><span class="line">    # The number of milliseconds of each tick</span><br><span class="line"> </span><br><span class="line">    # zookeeper 定义的基准时间间隔，单位：毫秒</span><br><span class="line">    tickTime=2000</span><br><span class="line"> </span><br><span class="line">    # The number of ticks that the initial </span><br><span class="line">    # synchronization phase can take</span><br><span class="line">    initLimit=10</span><br><span class="line">    # The number of ticks that can pass between </span><br><span class="line">    # sending a request and getting an acknowledgement</span><br><span class="line">    syncLimit=5</span><br><span class="line">    # the directory where the snapshot is stored.</span><br><span class="line">    # do not use /tmp for storage, /tmp here is just </span><br><span class="line">    # example sakes.</span><br><span class="line">    # dataDir=/tmp/zookeeper</span><br><span class="line"> </span><br><span class="line">    # 数据文件夹</span><br><span class="line">    dataDir=/usr/local/services/zookeeper/zookeeper-3.4.9/data</span><br><span class="line"> </span><br><span class="line">    # 日志文件夹</span><br><span class="line">    dataLogDir=/usr/local/services/zookeeper/zookeeper-3.4.9/logs</span><br><span class="line"> </span><br><span class="line">    # the port at which the clients will connect</span><br><span class="line">    # 客户端访问 zookeeper 的端口号</span><br><span class="line">    clientPort=2181</span><br><span class="line"> </span><br><span class="line">    # the maximum number of client connections.</span><br><span class="line">    # increase this if you need to handle more clients</span><br><span class="line">    #maxClientCnxns=60</span><br><span class="line">    #</span><br><span class="line">    # Be sure to read the maintenance section of the </span><br><span class="line">    # administrator guide before turning on autopurge.</span><br><span class="line">    #</span><br><span class="line">    # http://zookeeper.apache.org/doc/current/zookeeperAdmin.html#sc_maintenance</span><br><span class="line">    #</span><br><span class="line">    # The number of snapshots to retain in dataDir</span><br><span class="line">    #autopurge.snapRetainCount=3</span><br><span class="line">    # Purge task interval in hours</span><br><span class="line">    # Set to &quot;0&quot; to disable auto purge feature</span><br><span class="line">    #autopurge.purgeInterval=1</span><br><span class="line"> </span><br><span class="line">8、保存并关闭 zoo.cfg 文件:</span><br><span class="line">    </span><br><span class="line">9、进入到 /usr/local/services/zookeeper/zookeeper-3.4.9/bin 目录中：</span><br><span class="line">    cd ../bin/</span><br><span class="line"> </span><br><span class="line">10、用 vim 打开 /etc/ 目录下的配置文件 profile：</span><br><span class="line">    vim /etc/profile</span><br><span class="line">    并在其尾部追加如下内容：</span><br><span class="line"> </span><br><span class="line">    # idea - zookeeper-3.4.9 config start - 2016-09-08</span><br><span class="line"> </span><br><span class="line">    export ZOOKEEPER_HOME=/usr/local/services/zookeeper/zookeeper-3.4.9/</span><br><span class="line">    export PATH=$ZOOKEEPER_HOME/bin:$PATH</span><br><span class="line">    export PATH</span><br><span class="line"> </span><br><span class="line">    # idea - zookeeper-3.4.9 config start - 2016-09-08</span><br><span class="line"> </span><br><span class="line">11、使 /etc/ 目录下的 profile 文件即可生效：</span><br><span class="line">    source /etc/profile</span><br><span class="line"> </span><br><span class="line">12、启动 zookeeper 服务：</span><br><span class="line">    zkServer.sh start</span><br><span class="line">    如打印如下信息则表明启动成功：</span><br><span class="line">    ZooKeeper JMX enabled by default</span><br><span class="line">    Using config: /usr/local/services/zookeeper/zookeeper-3.4.9/bin/../conf/zoo.cfg</span><br><span class="line">    Starting zookeeper ... STARTED</span><br><span class="line"> </span><br><span class="line">13、查询 zookeeper 状态：</span><br><span class="line">    zkServer.sh status</span><br><span class="line"> </span><br><span class="line">14、关闭 zookeeper 服务：</span><br><span class="line">    zkServer.sh stop</span><br><span class="line">    如打印如下信息则表明成功关闭：</span><br><span class="line">    ZooKeeper JMX enabled by default</span><br><span class="line">    Using config: /usr/local/services/zookeeper/zookeeper-3.4.9/bin/../conf/zoo.cfg</span><br><span class="line">    Stopping zookeeper ... STOPPED</span><br><span class="line"> </span><br><span class="line">15、重启 zookeeper 服务：</span><br><span class="line">    zkServer.sh restart</span><br><span class="line">    如打印如下信息则表明重启成功：</span><br><span class="line">    ZooKeeper JMX enabled by default</span><br><span class="line">    Using config: /usr/local/services/zookeeper/zookeeper-3.4.9/bin/../conf/zoo.cfg</span><br><span class="line">    ZooKeeper JMX enabled by default</span><br><span class="line">    Using config: /usr/local/services/zookeeper/zookeeper-3.4.9/bin/../conf/zoo.cfg</span><br><span class="line">    Stopping zookeeper ... STOPPED</span><br><span class="line">    ZooKeeper JMX enabled by default</span><br><span class="line">    Using config: /usr/local/services/zookeeper/zookeeper-3.4.9/bin/../conf/zoo.cfg</span><br><span class="line">    Starting zookeeper ... STARTED</span><br></pre></td></tr></table></figure>
<h6 id="Kafka"><a href="#Kafka" class="headerlink" title="Kafka"></a>Kafka</h6><hr>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br></pre></td><td class="code"><pre><span class="line">  1、将包下载到相关的目录，然后解压Zookeeper到指定目录；</span><br><span class="line">    #cd /opt;</span><br><span class="line">    #tar -zxvf kafka_2.10-0.10.1.1.tgz;</span><br><span class="line">    </span><br><span class="line">  2、配置日志：进入到/opt/kafka_2.10-0.10.1.1目录创建日志目录；</span><br><span class="line">    #cd /opt/kafka_2.10-0.10.1.1；</span><br><span class="line">    #mkdir logs；</span><br><span class="line">    </span><br><span class="line">3、修改kafka配置文件；</span><br><span class="line">    进入到/opt/kafka_2.10-0.10.1.1/config目录，修改server.properties。</span><br><span class="line">                       #cd /opt/kafka_2.10-0.10.1.1/config；</span><br><span class="line">                       #vi server.properties #编辑修改相应的参数</span><br><span class="line">                          broker.id=0</span><br><span class="line">                          port=9092 #端口号</span><br><span class="line">                          host.name=127.0.0.1 #服务器IP地址，修改为自己的服务器IP</span><br><span class="line">                          log.dirs=/opt/kafka_2.10-0.10.1.1/logs #日志存放路径，上面创建的目录</span><br><span class="line">                          zookeeper.connect=localhost:2181 #zookeeper地址和端口，单机配置部署，localhost:2181</span><br><span class="line">                       #:wq! #保存退出</span><br><span class="line">                  4、启动Zookeeper：</span><br><span class="line">                       Kafka支持内置的Zookeeper和引用外部的Zookeeper，本文使用外部的Zookeeper。</span><br><span class="line">                       启动Zookeeper可以参考前面文章： Linux下Zookeeper的（单机）安装与简单测试。</span><br><span class="line">                  5、Kafka操作。</span><br><span class="line">                       （1）、启动kafka命令：</span><br><span class="line">                                #cd /opt/kafka_2.10-0.10.1.1/bin;</span><br><span class="line">                                # ./kafka-server-start.sh /opt/kafka_2.10-0.10.1.1/config/server.properties &amp;;</span><br><span class="line">                       （2）、停止kafka命令：</span><br><span class="line">                                # ./kafka-server-stop.sh</span><br><span class="line">                       （3）、创建Topic：(创建一个名为test的topic，只有一个副本，一个分区。)</span><br><span class="line">                                #./kafka-topics.sh --create --zookeeper 127.0.0.1:2181 --replication-factor 1 --partitions 1 --topic test</span><br><span class="line">                       （4）、列出所有Topic：</span><br><span class="line">                                #./kafka-topics.sh -list -zookeeper 127.0.0.1:2181                  </span><br><span class="line">                       （5）、启动Producer并发送消息：</span><br><span class="line">                                #./kafka-console-producer.sh --broker-list localhost:9092 --topic test</span><br><span class="line">                               （输入相应的消息，eg:hello kafka;按Ctrl+C结束）</span><br><span class="line">                        （6）、启动Consumer并接收消息：</span><br><span class="line">                                #./kafka-console-consumer.sh --zookeeper 127.0.0.1:2181 --topic test --from-beginning</span><br><span class="line">  </span><br><span class="line"></span><br><span class="line">kafka进程总是在启动一段时间后自动停止:解决                            </span><br><span class="line">bin/kafka-server-start.sh -daemon ./config/server.properties</span><br></pre></td></tr></table></figure>
<h6 id="ELK"><a href="#ELK" class="headerlink" title="ELK:"></a>ELK:</h6><ul>
<li>elasticsearch : <code>9200</code><ul>
<li>tar 解压;  </li>
<li>修改/config/jvm.options 中的内存为100M</li>
<li>bin / sh elasticsearch</li>
<li>安装IK分词器</li>
</ul>
</li>
</ul>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br></pre></td><td class="code"><pre><span class="line">1.download or compile</span><br><span class="line"></span><br><span class="line">-   optional 1 - download pre-build package from here: https://github.com/medcl/elasticsearch-analysis-ik/releases</span><br><span class="line"></span><br><span class="line">unzip plugin to folder your-es-root/plugins/</span><br><span class="line"></span><br><span class="line">-   optional 2 - use elasticsearch-plugin to install ( version &gt; v5.5.1 ):</span><br><span class="line"></span><br><span class="line">./bin/elasticsearch-plugin install https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v6.2.3/elasticsearch-analysis-ik-6.2.3.zip</span><br><span class="line"></span><br><span class="line">2.restart elasticsearch</span><br><span class="line">Quick Example</span><br><span class="line"></span><br><span class="line">1.create a index</span><br><span class="line"></span><br><span class="line">curl -XPUT http://localhost:9200/index</span><br><span class="line"></span><br><span class="line">2.create a mapping</span><br><span class="line"></span><br><span class="line">curl -XPOST http://localhost:9200/index/fulltext/_mapping -H &apos;Content-Type:application/json&apos; -d&apos;</span><br><span class="line">&#123;</span><br><span class="line">        &quot;properties&quot;: &#123;</span><br><span class="line">            &quot;content&quot;: &#123;</span><br><span class="line">                &quot;type&quot;: &quot;text&quot;,</span><br><span class="line">                &quot;analyzer&quot;: &quot;ik_max_word&quot;,</span><br><span class="line">                &quot;search_analyzer&quot;: &quot;ik_max_word&quot;</span><br><span class="line">            &#125;</span><br><span class="line">        &#125;</span><br><span class="line">    </span><br><span class="line">&#125;&apos;</span><br></pre></td></tr></table></figure>
<ul>
<li>kibana: <code>5601</code><ul>
<li>tar 解压;</li>
<li>sh kibana</li>
</ul>
</li>
<li>logstash :  <code>9600</code><ul>
<li>tar 解压;</li>
<li>修改/config/jvm.options 中的内存为100M</li>
<li>bin/logstash -e ‘input { stdin { } } output { stdout {} }’</li>
</ul>
</li>
</ul>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">启动命令：</span><br><span class="line">cd bin</span><br><span class="line">./logstash -e &apos;input &#123; stdin &#123; &#125; &#125; output &#123; stdout &#123;&#125; &#125;&apos;</span><br></pre></td></tr></table></figure>
<ul>
<li>如果出现以下代码表示启动成功：</li>
</ul>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line">Sending Logstash&apos;s logs to /home/rzxes/logstash-5.3.1/logs which is now configured via log4j2.properties</span><br><span class="line">[2017-05-16T10:27:36,957][INFO ][logstash.setting.writabledirectory] Creating directory &#123;:setting=&gt;&quot;path.queue&quot;, :path=&gt;&quot;/home/rzxes/logstash-5.3.1/data/queue&quot;&#125;</span><br><span class="line">[2017-05-16T10:27:37,041][INFO ][logstash.agent           ] No persistent UUID file found. Generating new UUID &#123;:uuid=&gt;&quot;c987803c-9b18-4395-bbee-a83a90e6ea60&quot;, :path=&gt;&quot;/home/rzxes/logstash-5.3.1/data/uuid&quot;&#125;</span><br><span class="line">[2017-05-16T10:27:37,581][INFO ][logstash.pipeline        ] Starting pipeline &#123;&quot;id&quot;=&gt;&quot;main&quot;, &quot;pipeline.workers&quot;=&gt;1, &quot;pipeline.batch.size&quot;=&gt;125, &quot;pipeline.batch.delay&quot;=&gt;5, &quot;pipeline.max_inflight&quot;=&gt;125&#125;</span><br><span class="line">[2017-05-16T10:27:37,682][INFO ][logstash.pipeline        ] Pipeline main started</span><br><span class="line">The stdin plugin is now waiting for input:</span><br><span class="line">[2017-05-16T10:27:37,886][INFO ][logstash.agent           ] Successfully started Logstash API endpoint &#123;:port=&gt;9600&#125;</span><br></pre></td></tr></table></figure>
<ul>
<li>Logstash连接mysql作为数据源，ES作为数据输出端：<ul>
<li>在Logstash的根目录新建文件xxx.conf;eg:test.conf;里面的内容为：</li>
</ul>
</li>
</ul>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br></pre></td><td class="code"><pre><span class="line">input &#123;</span><br><span class="line">    stdin &#123;</span><br><span class="line">    &#125;</span><br><span class="line">    jdbc &#123;</span><br><span class="line">      # 数据库地址  端口  数据库名</span><br><span class="line">      jdbc_connection_string =&gt; &quot;jdbc:mysql://127.0.0.1:3306/mamabuy-trade&quot;</span><br><span class="line">      # 数据库用户名</span><br><span class="line">      jdbc_user =&gt; &quot;root&quot;</span><br><span class="line">      # 数据库密码</span><br><span class="line">      jdbc_password =&gt; &quot;war3sxkcs&quot;</span><br><span class="line">      # mysql java驱动地址</span><br><span class="line">      jdbc_driver_library =&gt; &quot;/usr/local/software/mysql-connector-java-5.1.44.jar&quot;</span><br><span class="line">      jdbc_driver_class =&gt; &quot;com.mysql.jdbc.Driver&quot;</span><br><span class="line">      jdbc_paging_enabled =&gt; &quot;true&quot;</span><br><span class="line">      jdbc_page_size =&gt; &quot;100000&quot;</span><br><span class="line">      # sql 语句文件，也可以直接写SQL，如statement =&gt; &quot;select * from table1&quot;</span><br><span class="line">      statement_filepath =&gt; &quot;/usr/local/elk/logstash/test.sql&quot;</span><br><span class="line">      schedule =&gt; &quot;* * * * *&quot;</span><br><span class="line">      type =&gt; &quot;jdbc&quot;</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br><span class="line">output &#123;</span><br><span class="line">    stdout &#123;</span><br><span class="line">        codec =&gt; json_lines</span><br><span class="line">    &#125;</span><br><span class="line">    elasticsearch &#123;</span><br><span class="line">        hosts  =&gt; &quot;127.0.0.1:9200&quot;</span><br><span class="line">        index =&gt; &quot;test-1&quot; #索引名称</span><br><span class="line">        document_type =&gt; &quot;form&quot; #type名称</span><br><span class="line">        document_id =&gt; &quot;%&#123;id&#125;&quot; #id必须是待查询的数据表的序列字段</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<ul>
<li>并在logstash的根目录下新建文件<code>test.sql</code>;</li>
<li><code>test.sql</code>文件里面的内容为一条查询sql语句,eg:</li>
</ul>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line">1. eg:</span><br><span class="line">select * from table1</span><br><span class="line">2. 初次启动用全量同步：</span><br><span class="line">select id,category_id,brand_id,spu_name,price,status from t_product</span><br><span class="line">3. 下次启动用增量同步</span><br><span class="line">select id,category_id,brand_id,spu_name,price,status from t_product where update_time &gt; :sql_lastvalue</span><br></pre></td></tr></table></figure>
<ul>
<li>注意：<code>test.conf</code>和<code>test.sql</code>两个文件都在logstash的根目录下</li>
<li>此时再启动logstash:</li>
</ul>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">bin/logstash -f test.conf</span><br></pre></td></tr></table></figure>
<p><img src="https://sxk.s3.didiyunapi.com/pic/elk/1.jpg" alt="image"></p>
<ul>
<li>此时mysql中(test.conf配置)的数据库已经连接,test.sql里面的sql语句被执行;logstash从mysql里面查询值返回到ElasticSearch可以在kibana中可视化出来</li>
</ul>
<h5 id="Nginx"><a href="#Nginx" class="headerlink" title="Nginx"></a>Nginx</h5><hr>
<p>1.安装gcc gcc-c++(如新环境,未安装请先安装)</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ yum install -y gcc gcc-c++</span><br></pre></td></tr></table></figure>
<p>2.安装PCRE库</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line">$ cd /usr/local/</span><br><span class="line">$ wget http://jaist.dl.sourceforge.net/project/pcre/pcre/8.33/pcre-8.33.tar.gz</span><br><span class="line">$ tar -zxvf pcre-8.36.tar.gz</span><br><span class="line">$ cd pcre-8.36</span><br><span class="line">$ ./configure</span><br><span class="line">$ make &amp;&amp; make install</span><br><span class="line"></span><br><span class="line">或者：yum install -y pcre pcre-devel</span><br></pre></td></tr></table></figure>
<p>3.安装SSL库</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line">$ cd /usr/local/</span><br><span class="line">$ wget http://www.openssl.org/source/openssl-1.0.1j.tar.gz</span><br><span class="line">$ tar -zxvf openssl-1.0.1j.tar.gz</span><br><span class="line">$ cd openssl-1.0.1j</span><br><span class="line">$ ./config</span><br><span class="line">$ make &amp;&amp; make install</span><br><span class="line"></span><br><span class="line">或者：yum install -y openssl openssl-devel</span><br></pre></td></tr></table></figure>
<p>4.安装zlib库存</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line">$ cd /usr/local/</span><br><span class="line">$ wget http://zlib.net/zlib-1.2.11.tar.gz</span><br><span class="line">$ tar -zxvf zlib-1.2.11.tar.gz</span><br><span class="line">$ ./configure</span><br><span class="line">$ make &amp;&amp; make install</span><br><span class="line"></span><br><span class="line">或者：yum install -y zlib zlib-devel</span><br></pre></td></tr></table></figure>
<p>5.安装nginx</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br></pre></td><td class="code"><pre><span class="line">$ cd /usr/local/</span><br><span class="line">$ wget -c https://nginx.org/download/nginx-1.10.1.tar.gz</span><br><span class="line">$ tar -zxvf nginx-1.10.0.tar.gz</span><br><span class="line">$ cd nginx-1.10.0 </span><br><span class="line">$ 建议：./configure</span><br><span class="line">$ 不建议：./configure --user=nobody --group=nobody --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_gzip_static_module --with-http_realip_module --with-http_sub_module --with-http_ssl_module</span><br><span class="line">(注: --with-http_ssl_module:这个不加后面在nginx.conf配置ssl:on后,启动会报nginx: [emerg] unknown directive &quot;ssl&quot; in /opt/nginx/conf/nginx.conf 异常)</span><br><span class="line">$ make &amp;&amp; make install</span><br><span class="line"></span><br><span class="line">报错:./configure: error: the HTTP gzip module requires the zlib library</span><br><span class="line"></span><br><span class="line">在–prefix后面接以下命令:</span><br><span class="line"></span><br><span class="line">--with-pcre=/usr/local/pcre-8.36 指的是pcre-8.36 的源码路径。--with-zlib=/usr/local/zlib-1.2.8 指的是zlib-1.2.8 的源码路径。</span><br></pre></td></tr></table></figure>
<h6 id="SSL"><a href="#SSL" class="headerlink" title="SSL"></a>SSL</h6><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br></pre></td><td class="code"><pre><span class="line">upstream smallkk &#123;</span><br><span class="line">    server 127.0.0.1:8080;</span><br><span class="line">&#125;</span><br><span class="line">server &#123;</span><br><span class="line">    listen 80;</span><br><span class="line">    server_name www.s-name.com;</span><br><span class="line">    rewrite ^(.*) https://$host$1 permanent;</span><br><span class="line">&#125;</span><br><span class="line">server &#123;</span><br><span class="line">    listen 443 ssl;</span><br><span class="line">    server_name www.s-name.com;</span><br><span class="line">    ssl on;</span><br><span class="line">    ssl_certificate 1_s-name.com_bundle.crt;</span><br><span class="line">    ssl_certificate_key 2_s-name.com.key;</span><br><span class="line">    ssl_session_timeout 5m;</span><br><span class="line">    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;</span><br><span class="line">    ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE;</span><br><span class="line">    ssl_prefer_server_ciphers on;</span><br><span class="line">    location / &#123;</span><br><span class="line">        root html;</span><br><span class="line">        index index.html index.htm;</span><br><span class="line">        proxy_pass http://smallkk;</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<p>6.启动</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">$ /usr/local/nginx/sbin/nginx</span><br><span class="line">or</span><br><span class="line">[root@localhost sbin]# ./nginx    -c /usr/local/nginx-1.10.1/conf/nginx.conf </span><br><span class="line">&lt;!--指定下位置再启动--&gt;</span><br></pre></td></tr></table></figure>
<p>7.重启</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ /usr/local/nginx/sbin/nginx –s reload</span><br></pre></td></tr></table></figure>
<p>8.停止</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ /usr/local/nginx/sbin/nginx –s stop</span><br></pre></td></tr></table></figure>
<p>9.测试配置文件是否正常</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ /usr/local/nginx/sbin/nginx –t</span><br></pre></td></tr></table></figure>
<p>10.强制关闭</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ pkill nginx</span><br></pre></td></tr></table></figure>
<h6 id="配置："><a href="#配置：" class="headerlink" title="配置："></a>配置：</h6><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br><span class="line">84</span><br><span class="line">85</span><br><span class="line">86</span><br><span class="line">87</span><br><span class="line">88</span><br><span class="line">89</span><br><span class="line">90</span><br><span class="line">91</span><br><span class="line">92</span><br><span class="line">93</span><br><span class="line">94</span><br><span class="line">95</span><br><span class="line">96</span><br><span class="line">97</span><br><span class="line">98</span><br><span class="line">99</span><br><span class="line">100</span><br><span class="line">101</span><br><span class="line">102</span><br><span class="line">103</span><br><span class="line">104</span><br><span class="line">105</span><br><span class="line">106</span><br><span class="line">107</span><br><span class="line">108</span><br><span class="line">109</span><br><span class="line">110</span><br><span class="line">111</span><br><span class="line">112</span><br><span class="line">113</span><br><span class="line">114</span><br><span class="line">115</span><br><span class="line">116</span><br><span class="line">117</span><br><span class="line">118</span><br><span class="line">119</span><br></pre></td><td class="code"><pre><span class="line">Server</span><br><span class="line"></span><br><span class="line">接收请求的服务器需要将不同的请求按规则转发到不同的后端服务器上，在 nginx 中我们可以通过构建虚拟主机（server）的概念来将这些不同的服务配置隔离。</span><br><span class="line"></span><br><span class="line">server &#123;</span><br><span class="line">listen 80;</span><br><span class="line">server_name localhost;</span><br><span class="line">root html;</span><br><span class="line">index index.html index.htm;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line">例如我们笔戈玩下的两个子项目 passport 和 wan 就可以通过在 nginx 的配置文件中配置两个 server，servername 分别为 passport.bigertech.com 和 wan.bigertech.com。这样的话不同的 url 请求就会对应到 nginx 相应的设置，转发到不同的后端服务器上。</span><br><span class="line">这里的 listen 指监听端口，server_name 用来指定IP或域名，多个域名对应统一规则可以空格分开，index 用于设定访问的默认首页地址，root 指令用于指定虚拟主机的网页跟目录，这个地方可以是相对地址也可以是绝对地址。</span><br><span class="line">通常情况下我们可以在 nginx.conf 中配置多个server，对不同的请求进行设置。就像这样：</span><br><span class="line"></span><br><span class="line">server &#123;</span><br><span class="line">listen 80;</span><br><span class="line">server_name host1;</span><br><span class="line">root html;</span><br><span class="line">index index.html</span><br><span class="line">index.htm;</span><br><span class="line">&#125;</span><br><span class="line">server &#123;</span><br><span class="line">listen 80;</span><br><span class="line">server_name host2;</span><br><span class="line">root /data/www/html;</span><br><span class="line">index index.html index.htm;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line">但是当 server 超过2个时，建议将不同对虚拟主机的配置放在另一个文件中，然后通过在主配置文件 nginx.conf 加上 include 指令包含进来。更便于管理。</span><br><span class="line"></span><br><span class="line">include vhosts/*.conf;</span><br><span class="line"></span><br><span class="line">就可以把vhosts的文件都包含进去啦。</span><br><span class="line"></span><br><span class="line">Localtion</span><br><span class="line">每个 url 请求都会对应的一个服务，nginx 进行处理转发或者是本地的一个文件路径，或者是其他服务器的一个服务路径。而这个路径的匹配是通过 location 来进行的。我们可以将 server 当做对应一个域名进行的配置，而 location 是在一个域名下对更精细的路径进行配置。</span><br><span class="line"></span><br><span class="line">以上面的例子，可以将root和index指令放到一个location中，那么只有在匹配到这个location时才会访问root后的内容：</span><br><span class="line"></span><br><span class="line">location / &#123;</span><br><span class="line">   root /data/www/host2; </span><br><span class="line">   index index.html index.htm; </span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line">location 匹配规则</span><br><span class="line"></span><br><span class="line">~ 波浪线表示执行一个正则匹配，区分大小写</span><br><span class="line">~* 表示执行一个正则匹配，不区分大小写</span><br><span class="line">^~ ^~表示普通字符匹配，如果该选项匹配，只匹配该选项，不匹配别的选项，一般用来匹配目录</span><br><span class="line">= 进行普通字符精确匹配</span><br><span class="line"></span><br><span class="line">匹配例子：</span><br><span class="line"></span><br><span class="line">location = / &#123;</span><br><span class="line"># 只匹配&quot;/&quot;. [ configuration A ]</span><br><span class="line">&#125;</span><br><span class="line">location / &#123;</span><br><span class="line"># 匹配任何请求，因为所有请求都是以&quot;/&quot;开始 # 但是更长字符匹配或 者正则表达式匹配会优先匹配 [ configuration B ]</span><br><span class="line">&#125;</span><br><span class="line">location ^~ /images/ &#123;</span><br><span class="line"># 匹配任何以 /images/ 开始的请求，并停止匹配 其它</span><br><span class="line">location [ configuration C ]</span><br><span class="line">&#125;</span><br><span class="line">location ~* .(gif|jpg|jpeg)$ &#123;</span><br><span class="line"># 匹配以 gif, jpg, or jpeg结尾的请求.</span><br><span class="line"># 但是所有 /images/ 目录的请求将由 [Configuration C]处理.</span><br><span class="line">[ configuration D ]</span><br><span class="line">&#125;</span><br><span class="line">请求:/ -&gt; 符合configuration A</span><br><span class="line">/documents/document.html -&gt; 符合configuration B</span><br><span class="line">/images/1.gif -&gt; 符合configuration C</span><br><span class="line">/documents/1.jpg -&gt;符合 configuration D</span><br><span class="line"></span><br><span class="line">静态文件映射</span><br><span class="line">访问文件的配置主要有 root 和 aliasp’s 两个指令。这两个指令的区别容易弄混：</span><br><span class="line">alias</span><br><span class="line">alias后跟的指定目录是准确的，并且末尾必须加 /。</span><br><span class="line"></span><br><span class="line">location /c/ &#123;</span><br><span class="line">alias /a/;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line">root</span><br><span class="line">root后跟的指定目录是上级目录，并且该上级目录下要含有和location后指定名称的同名目录才行。</span><br><span class="line"></span><br><span class="line">location /c/ &#123;</span><br><span class="line">root /a/;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line">如果你需要将这个目录展开，在这个location的末尾加上「autoindex on; 」就可以了</span><br><span class="line"></span><br><span class="line">转发</span><br><span class="line">配置起来很简单比如我要将所有的请求到转移到真正提供服务的一台机器的 8001 端口，只要这样：</span><br><span class="line"></span><br><span class="line">location / &#123;</span><br><span class="line">proxy_pass 172.16.1.1:8001;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line">这样访问host时，就都被转发到 172.16.1.1的8001端口去了。</span><br><span class="line"></span><br><span class="line">负载均衡</span><br><span class="line"></span><br><span class="line">upstream myserver; &#123;</span><br><span class="line">ip_hash;</span><br><span class="line">server 172.16.1.1:8001;</span><br><span class="line">server 172.16.1.2:8002;</span><br><span class="line">server 172.16.1.3;</span><br><span class="line">server 172.16.1.4;</span><br><span class="line">&#125;</span><br><span class="line">location / &#123;</span><br><span class="line">proxy_pass http://myserver;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line">我们在 upstream 中指定了一组机器，并将这个组命名为 myserver，这样在 proxypass 中只要将请求转移到 myserver 这个 upstream 中我们就实现了在四台机器的反向代理加负载均衡。其中的 ip_hash 指明了我们均衡的方式是按照用户的 ip 地址进行分配。另外还有轮询、指定权重轮询、fair、url_hash几种调度算法。</span><br><span class="line"></span><br><span class="line">总结</span><br><span class="line"></span><br><span class="line">以上是最简单的通过 nginx 实现静态文件转发、反向代理和负载均衡的配置。在 nginx 中所有的功能都是通过模块来实现的，比如当我们配置 upstream 时是用 upstream 模块，而 server 和 location 是在 http core 模块，其他的还有流控的 limt 模块，邮件的 mail 模块，https 的 ssl 模块。他们的配置都是类似的可以再 nginx 的模块文档中找到详细的配置说明。</span><br></pre></td></tr></table></figure>

      
    </div>
    
    
    

    

    

    

    <footer class="post-footer">
      

      
      
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
              <a href="/2018/03/24/深入理解Java虚拟机/" rel="next" title="深入理解Java虚拟机">
                <i class="fa fa-chevron-left"></i> 深入理解Java虚拟机
              </a>
            
          </div>

          <span class="post-nav-divider"></span>

          <div class="post-nav-prev post-nav-item">
            
              <a href="/2018/04/29/Nginx/" rel="prev" title="Nginx">
                Nginx <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </div>
  
  
  
  </article>



    <div class="post-spread">
      
    </div>
  </div>


          </div>
          


          

  



        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    
    <div class="sidebar-inner">

      

      
        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap">
            文章目录
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview-wrap">
            站点概览
          </li>
        </ul>
      

      <section class="site-overview-wrap sidebar-panel">
        <div class="site-overview">
          <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
            
              <p class="site-author-name" itemprop="name">S-Name Small·kk</p>
              <p class="site-description motion-element" itemprop="description">开源 | Java | 个人笔记 | 我的博客</p>
          </div>

          <nav class="site-state motion-element">

            
              <div class="site-state-item site-state-posts">
              
                <a href="/archives/">
              
                  <span class="site-state-item-count">12</span>
                  <span class="site-state-item-name">日志</span>
                </a>
              </div>
            

            

            

          </nav>

          

          

          
          

          
          

          

        </div>
      </section>

      
      <!--noindex-->
        <section class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc">

            
              
            

            
              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-6"><a class="nav-link" href="#IDEA-Templet"><span class="nav-number">1.</span> <span class="nav-text">IDEA Templet</span></a></li><li class="nav-item nav-level-6"><a class="nav-link" href="#CentOS："><span class="nav-number">2.</span> <span class="nav-text">CentOS：</span></a></li><li class="nav-item nav-level-6"><a class="nav-link" href="#释放内存："><span class="nav-number">3.</span> <span class="nav-text">释放内存：</span></a></li><li class="nav-item nav-level-6"><a class="nav-link" href="#port"><span class="nav-number">4.</span> <span class="nav-text">port:</span></a></li><li class="nav-item nav-level-6"><a class="nav-link" href="#rpm"><span class="nav-number">5.</span> <span class="nav-text">rpm:</span></a></li><li class="nav-item nav-level-6"><a class="nav-link" href="#redis"><span class="nav-number">6.</span> <span class="nav-text">redis</span></a></li><li class="nav-item nav-level-6"><a class="nav-link" href="#MySQL"><span class="nav-number">7.</span> <span class="nav-text">MySQL</span></a></li><li class="nav-item nav-level-6"><a class="nav-link" href="#wifi"><span class="nav-number">8.</span> <span class="nav-text">wifi</span></a></li><li class="nav-item nav-level-6"><a class="nav-link" href="#firewall"><span class="nav-number">9.</span> <span class="nav-text">firewall</span></a></li><li class="nav-item nav-level-6"><a class="nav-link" href="#Zookeeper"><span class="nav-number">10.</span> <span class="nav-text">Zookeeper</span></a></li><li class="nav-item nav-level-6"><a class="nav-link" href="#Kafka"><span class="nav-number">11.</span> <span class="nav-text">Kafka</span></a></li><li class="nav-item nav-level-6"><a class="nav-link" href="#ELK"><span class="nav-number">12.</span> <span class="nav-text">ELK:</span></a></li></ol></li><li class="nav-item nav-level-5"><a class="nav-link" href="#Nginx"><span class="nav-number"></span> <span class="nav-text">Nginx</span></a><ol class="nav-child"><li class="nav-item nav-level-6"><a class="nav-link" href="#SSL"><span class="nav-number">1.</span> <span class="nav-text">SSL</span></a></li><li class="nav-item nav-level-6"><a class="nav-link" href="#配置："><span class="nav-number">2.</span> <span class="nav-text">配置：</span></a></li></ol></div>
            

          </div>
        </section>
      <!--/noindex-->
      

      

    </div>
  </aside>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright">&copy; <span itemprop="copyrightYear">2018</span>
  <span class="with-love">
    <i class="fa fa-user"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">S-Name Small·kk</span>

  
</div>


  <div class="powered-by">由 <a class="theme-link" target="_blank" href="https://hexo.io">Hexo</a> 强力驱动</div>



  <span class="post-meta-divider">|</span>



  <div class="theme-info">主题 &mdash; <a class="theme-link" target="_blank" href="https://github.com/iissnan/hexo-theme-next">NexT.Pisces</a> v5.1.4</div>




        







        
      </div>
    </footer>

    
      <div class="back-to-top">
        <i class="fa fa-arrow-up"></i>
        
      </div>
    

    

  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>









  












  
  
    <script type="text/javascript" src="/lib/jquery/index.js?v=2.1.3"></script>
  

  
  
    <script type="text/javascript" src="/lib/fastclick/lib/fastclick.min.js?v=1.0.6"></script>
  

  
  
    <script type="text/javascript" src="/lib/jquery_lazyload/jquery.lazyload.js?v=1.9.7"></script>
  

  
  
    <script type="text/javascript" src="/lib/velocity/velocity.min.js?v=1.2.1"></script>
  

  
  
    <script type="text/javascript" src="/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>
  

  
  
    <script type="text/javascript" src="/lib/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script>
  


  


  <script type="text/javascript" src="/js/src/utils.js?v=5.1.4"></script>

  <script type="text/javascript" src="/js/src/motion.js?v=5.1.4"></script>



  
  


  <script type="text/javascript" src="/js/src/affix.js?v=5.1.4"></script>

  <script type="text/javascript" src="/js/src/schemes/pisces.js?v=5.1.4"></script>



  
  <script type="text/javascript" src="/js/src/scrollspy.js?v=5.1.4"></script>
<script type="text/javascript" src="/js/src/post-details.js?v=5.1.4"></script>



  


  <script type="text/javascript" src="/js/src/bootstrap.js?v=5.1.4"></script>



  


  




	





  





  












  





  

  

  

  
  

  

  

  

</body>
</html>
